<ui:composition template="/WEB-INF/templates/template-principal.xhtml" xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets">

	<ui:define name="conteudo">
		<h:form>
			<h:dataTable rendered="${not empty funcionarioBean.funcionarios}" value="#{funcionarioBean.funcionarios}" var="func"
				styleClass="tabela">
				<f:facet name="header">Funcionários</f:facet>

				<h:column>
					<f:facet name="header">Nome</f:facet>
					#{func.nome}
				</h:column>

				<h:column>
					<f:facet name="header">Departamento</f:facet>
					#{func.departamento.nome}
				</h:column>

				<h:column>
					<f:facet name="header">Profissão</f:facet>
					#{func.profissao}
				</h:column>

				<h:column>
					<f:facet name="header">Opções</f:facet>
					<h:panelGroup>
						<h:commandLink value="Alterar" action="#{funcionarioBean.preparaAlteracao()}">
							<f:param name="idFuncionario" value="#{func.id}" />
						</h:commandLink>
						-
						<h:commandLink value="Remover" action="#{funcionarioBean.remove()}">
							<f:param name="idFuncionario" value="#{func.id}" />
						</h:commandLink>
					</h:panelGroup>
				</h:column>
			</h:dataTable>

			<h:panelGroup rendered="${empty funcionarioBean.funcionarios}">
				<h1>Não há funcionários</h1>
			</h:panelGroup>
		</h:form>
	</ui:define>
	
</ui:composition>
